package com.qianfeng.smartdevice.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
@ApiModel(description = "设备数据对象")
public class Device implements CheckEmptyInterface{
  @ApiModelProperty(value = "主键查询时候返回")
  private Long id;
  @ApiModelProperty(value = "设备uuid",required = true,example = "HT1234567890")
  private String devicesuuid;
  @ApiModelProperty(value = "设备名字",required = true,example = "小爱同学")
  private String devicename;
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  @ApiModelProperty(value = "设备名字",hidden = true)
  private Date addtime;
  @ApiModelProperty(value = "地址",required = true,example = "沙阳路32号")
  private String address;
  @ApiModelProperty(value = "区域id",required = true,example = "1")
  private Long areaid;
  @ApiModelProperty(value = "方向0左1右",required = true,example = "1")
  private String direction;
  @ApiModelProperty(value = "在方向的位置",required = true,example = "1")
  private Long num;
  @ApiModelProperty(value = "状态",required = true,example = "1")
  private String status;//状态,0离线,1 在线,2 损坏 3 待上线
  @ApiModelProperty(value = "最后连接时间",hidden = true,example = "2021-06-03 13:00:00")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  private Date lastconnecttime;
  @ApiModelProperty(value = "区域名字",hidden = true)
  private String areaname;//冗余数据,记录所属的区域的名字
  @ApiModelProperty(value = "分类ID",required = true,example = "1")
  private Long categoryid;//分类 id,冗余字段
  @ApiModelProperty(value = "分类名字",hidden = true)
  private String categoryname;//分类名字,冗余数据

  @ApiModelProperty(value = "分类对象",hidden = true)
  private Category category;//所属分类,备用,主要用于对命令的查询操作

  public Category getCategory() {
    return category;
  }

  public void setCategory(Category category) {
    this.category = category;
    if (category != null) {
      this.categoryid = category.getId();
      this.categoryname = category.getCategoryname();
    }
  }

  public Long getCategoryid() {
    return categoryid;
  }

  public void setCategoryid(Long categoryid) {
    this.categoryid = categoryid;
  }

  public String getCategoryname() {
    return categoryname;
  }

  public void setCategoryname(String categoryname) {
    this.categoryname = categoryname;
  }

  public String getAreaname() {
    return areaname;
  }

  public void setAreaname(String areaname) {
    this.areaname = areaname;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getDevicesuuid() {
    return devicesuuid;
  }

  public void setDevicesuuid(String devicesuuid) {
    this.devicesuuid = devicesuuid;
  }

  public String getDevicename() {
    return devicename;
  }

  public void setDevicename(String devicename) {
    this.devicename = devicename;
  }

  public Date getAddtime() {
    return addtime;
  }

  public void setAddtime(Date addtime) {
    this.addtime = addtime;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public Long getAreaid() {
    return areaid;
  }

  public void setAreaid(Long areaid) {
    this.areaid = areaid;
  }

  public String getDirection() {
    return direction;
  }

  public void setDirection(String direction) {
    this.direction = direction;
  }

  public Long getNum() {
    return num;
  }

  public void setNum(Long num) {
    this.num = num;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public Date getLastconnecttime() {
    return lastconnecttime;
  }

  public void setLastconnecttime(Date lastconnecttime) {
    this.lastconnecttime = lastconnecttime;
  }

  @Override
  public boolean isEmpty() {
    return devicesuuid==null&&devicename==null&&address==null&&areaid==null&&direction==null&&num==null&&status==null;
  }
}
